<!-- 子页面>右边 -->
<template>
    <div class="childRight-container">
        <component
            v-if="isRouterAlive"
            :is="pageName"
            :parames="transData"
        ></component>
    </div>
</template>

<script>
import MapEquipment from "./RightCompt/MapEquipment"; // 设备一张图
import ReceivingPolice from "./RightCompt/ReceivingPolice"; //e接处警
import RectificationDangers from "./RightCompt/RectificationDangers"; //隐患整改
import Inspection from "./RightCompt/Inspection"; //巡检
import Maintenance from "./RightCompt/Maintenance"; //维保
export default {
    name: "ChildRight",
    components: {
        MapEquipment,
        ReceivingPolice,
        RectificationDangers,
        Inspection,
        Maintenance
    },
    props: {
        parames: {
            required: true
        }
    },
    data() {
        return {
            pageName: "",
            transData: {},
            isRouterAlive: true
        };
    },
    computed: {},
    watch: {},
    created: function() {
        window.FunList.refreshChidRight = this.freshPage;
        if (this.parames) {
            this.freshPage(this.parames);
        }
    },
    methods: {
        freshPage(param) {
            if (this.pageName == param.pageName) {
                this.reload();
            }
            this.transData = param;
            this.pageName = param.pageName;
        },
        reload() {
            this.isRouterAlive = false;
            this.$nextTick(() => (this.isRouterAlive = true));
        }
    }
};
</script>

<style scoped rel="stylesheet/scss" lang="scss">
.childRight-container {
    width: 100%;
    padding-left: 10px;
    height: 100%;
}
</style>
